﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {


       static void OPER(int r, int k, string[] z,int r2)
        {
            if (k == 6)
            {
                if (r == r2)
                {

                    Console.Write("((((1 " + z[1] + " ");
                    for (int i = 2; i < 6; ++i)
                    {
                        Console.Write(i + ")" + z[i] + " ");
                    }
                    Console.WriteLine("6 = " + r2);
                    
                    //int t=++;
                    Console.WriteLine();

                }
            }
            else
            {
                z[k] = "+"; 
                OPER(r + k + 1, k + 1, z,r2);
                z[k] = "-"; 
                OPER(r - k - 1, k + 1, z,r2);
                z[k] = "*"; 
                OPER(r * (k + 1), k + 1, z,r2);
                z[k] = "/";
                OPER(r / (k + 1), k + 1, z, r2);
            }
            
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Введите число");
            int r2 = 0;
            r2 = Convert.ToInt32(Console.ReadLine());
            
            string[] z = new string[6];
            OPER(1, 1, z,r2);
            
            Console.ReadLine();

        }
    }
}
